{extends file="../home.html"}
{block name="title"}{$head_title}{/block}

{block name="css"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/front/front_css/refresh_load.css?version={$version}"/>
<link href="__PUBLIC__/Css/front/css/channel_index.css?version={$version}" type="text/css" rel="stylesheet">
<style type="text/css">
body{
	background: #F3F3F3;
	padding-bottom: 50px;
}

    .channel_info {
        font-size: 0.6rem;
        margin-left: 0.45rem;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        max-width:13rem;
    }
</style>
{/block}
{block name="content"}


	<div class="com_header">
		{if $follow_channel_list}
			<span class="qiandao" {if $all_sign}style="display:block"{else}style="display:none"{/if}>一键签到</span>
			<!-- 已签到 -->
			<span class="qd_yes" {if !$all_sign}style="display:block"{/if}>已签到</span>
		{else}
			<span class="qiandao">一键签到</span>
		{/if}
		频道<a href="/FrontIndex/search" class="search native_go"><i class="icon_search"></i></a><a href="/FrontIndex/message_center" class="msg native_go"><i class="icon_msg"></i>{if $is_read}<span class="dot"></span>{/if}</a>
	</div>


	<!-- 轮播图 -->
    <div class="swiper-container home_banner">
        <div class="swiper-wrapper">
            {foreach from=$cust_flash_list item=v}
		    <div class="swiper-slide">
		        <a href="{$v.link}" class="native_go"><img src="{$v.pic}?imageMogr2/auto-orient/imageslim" alt=""></a>
		    </div>
		    {/foreach}
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>
    </div>




	<!-- 我关注的频道： -->
	<div class="my_channel">
		<h3>我关注的频道：</h3>
		{if $follow_channel_list}
		<ul class="my_list">
			{foreach from=$follow_channel_list item=v}
			<li>
				<a href="/FrontChannel/post_list/channel_id/{$v.followed_id}" class="native_go">
					<img src="{$v.icon}?imageView2/1/w/200/h/200/imageslim" alt="">
                    <div>
                        <span class="channel_name">{$v.channel_name}<i class="level" style="padding: 0 0.25rem;">{$v.user_channel_rank}</i></span>
                        <p class="channel_info">{$v.summary}</p>
                    </div>
					{if $v.is_sign}<i class="icon_qd"></i>{/if}
					<span class="new_num">新帖{$v.tie_num}</span>
				</a>
			</li>
			{/foreach}
		</ul>
		{/if}
	</div>


	{if !$is_hidden}
	<!--su 2017.9.21 所有频道 start-->
		<ul class="all_channel">
			<h3 style="padding: .6rem; border-bottom: 1px solid #EFEFEF; font-size: .7rem;  color: #909090;  letter-spacing: 0.15px;">所有频道</h3>
			{foreach from=$sort_list item=v}
			<li>
				<div class="li_row">
					<img src="{$v.pic}" alt="" class="sm_img"><span class="title">{$v.channel_sort_name}</span><i class="num">（{$v.channel_num}）</i><i class="icon_down"></i>
				</div>
				<div class="hide_wrap">
					{foreach from=$v.channel_list item=channel}
					<a href="/FrontChannel/post_list/channel_id/{$channel.channel_id}" class="native_go">
						<div class="hide_box">
							<img src="{$channel.icon}?imageView2/1/w/200/h/200/imageslim" alt="">
							<span>{$channel.channel_name}</span>
							<em>今日新帖{$channel.new_tie}</em>
						</div>
					</a>
					{/foreach}
				</div>
			</li>
			{/foreach}
		</ul>
	{else}
	{/if}

	<!--su 2017.9.21 所有频道 end-->




{/block}
{block name="js"}

{literal}

<script>
	var clicking = false;

	var home_banner = new Swiper('.home_banner',{
        pagination: '.swiper-pagination',
        paginationClickable: true,
        autoplay: 2000,//可选选项，自动滑动
        autoplayDisableOnInteraction : false,
        loop : true,
    })


	$('.qiandao').on('click',function(){
		if(clicking){
			return;
		}
		clicking = true;
		$.ajax({
			url:'/FrontChannel/all_sign',
			type:'post',
			success:function(r){
				if(r.code == 1){
					$('#tan').html(r.msg);
					tishi();
					// toast(r.msg, 'fail');
				}else{
					$('.qiandao').hide();
					toast('已签到', 'succ');
				    $('.qd_yes').show();
				}
				clicking = false;
			}
		})


	})
    $('.all_channel li').on('click',function(){
        $(this).toggleClass('active');
        $(this).find('.hide_wrap').toggle();
    })

</script>
{/literal}
{/block}